﻿using YDT_ProductService.Domains.Entities;
using YDT_ProductService.Domains.Enums;

namespace YDT_ProductService.Domains.Interfaces
{
    /// <summary>
    /// 商品仓储接口 - 定义商品数据访问契约
    /// </summary>
    public interface IProductRepository
    {
        /// <summary>根据ID获取商品</summary>
        Task<Product?> GetByIdAsync(Guid id);
        /// <summary>根据商品编码获取商品</summary>
        Task<Product?> GetByProductCodeAsync(string productCode);
        /// <summary>获取所有商品</summary>
        Task<IEnumerable<Product>> GetAllAsync();
        /// <summary>根据状态获取商品</summary>
        Task<IEnumerable<Product>> GetByStatusAsync(ProductStatus status);
        /// <summary>分页获取商品</summary>
        Task<(IEnumerable<Product> Products, int TotalCount)> GetPagedAsync(int pageIndex, int pageSize);
        /// <summary>添加商品</summary>
        Task AddAsync(Product product);
        /// <summary>更新商品</summary>
        Task UpdateAsync(Product product);
        /// <summary>删除商品</summary>
        Task DeleteAsync(Guid id);
        /// <summary>检查商品是否存在</summary>
        Task<bool> ExistsAsync(Guid id);
        /// <summary>检查商品编码是否存在</summary>
        Task<bool> ProductCodeExistsAsync(string productCode);
    }
}
